package cn.stronglink.suite.core.config;

import java.util.List;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;

@EnableWebMvc
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
	
	@Override
	 public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
	    FastJsonHttpMessageConverter fastJsonConverter = new FastJsonHttpMessageConverter();
	    FastJsonConfig fjc = new FastJsonConfig();
	    //1、序列化重点
	    fjc.setSerializerFeatures(SerializerFeature.BrowserCompatible);
	    fastJsonConverter.setFastJsonConfig(fjc);
	    converters.add(fastJsonConverter);
	 }

}
